﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GNF.GPS.ROYALTEK;

namespace RoyelTekTesterProject
{
    class Program
    {
        static void Main(string[] args)
        {
            SerialCommunicationManager manager = new SerialCommunicationManager(10);
            foreach (var port in SerialCommunicationManager.GetAvailablePortsNames() )
	        {
                System.Console.WriteLine(port);		 
	        }
            
            manager.DataReceived +=new GNF.GPS.ROYALTEK.Communication.DataReceivedEventHandler(manager_DataReceived);
            manager.OpenPort();

            System.Console.ReadKey();

            manager.ClosePort();
            System.Console.ReadKey();
        }

        static void  manager_DataReceived(object sender, GNF.GPS.ROYALTEK.Communication.DataReceivedEventArgs e)
        {
            System.Console.WriteLine(e.Data);
            System.Console.WriteLine();
            System.Console.WriteLine(System.Threading.Thread.CurrentThread.Name);
            System.Console.WriteLine();
            System.Console.WriteLine("end of message");
        }

        
    }
}
